package com.bfl.sa.personal.message.converter;

import com.bfl.sa.personal.message.entity.Message;
import com.bfl.sa.personal.message.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;

public class MessageConverter implements Converter<String, Message> {

    @Autowired
    private MessageService messageService;

    @Override
    public Message convert(String id) {
        return messageService.findOne(Long.parseLong(id));
    }
}
